<?php
declare (strict_types = 1);

namespace App\Controller\Packet;

use App\Controller\AbstractController;

/**
 *
 */
class CodePacket extends AbstractController
{
    public $clientPacketStruct = [
        'CLIENT_VERSION'   => [
            'count'        => 'uint32',
            'version_hash' => '[]int8',
        ],
        'KEEP_ALIVE'       => [
            'time' => 'int64',
        ],
        'NEW_ACCOUNT'      => [
            'account'         => 'string',
            'password'        => 'string',
            'date_time'       => 'int64',
            'user_name'       => 'string',
            'secret_question' => 'string',
            'secret_answer'   => 'string',
            'email_address'   => 'string',
        ],
        'CHANGE_PASSWORD'  => [
            'account'          => 'string',
            'current_password' => 'string',
            'new_password'     => 'string',
        ],
        'LOGIN'            => [
            'account'  => 'string',
            'password' => 'string',
        ],
        'NEW_CHARACTER'    => [
            'name'   => 'string',
            'gender' => 'int8',
            'class'  => 'int8',
        ],
        'DELETE_CHARACTER' => [
            'character_index' => 'int32',
        ],
        'START_GAME'       => [
            'character_index' => 'int16',
        ],
        'WALK'             => [
            'direction' => 'uint8',
        ],
        'RUN'              => [
            'direction' => 'uint8',
        ],
        'TURN'             => [
            'direction' => 'uint8',
        ],
        'LOG_OUT'          => [

        ],
        'CHAT'             => [
            'message' => 'string',
            'type'    => 'uint8',
        ],
        'OPENDOOR'         => [
            'door_index' => 'uint8',
        ],
        'REFINE_CANCEL'    => [],
        'EQUIP_ITEM'       => [
            'grid'      => 'uint8',
            'unique_id' => 'uint64',
            'to'        => 'int32',
        ],
        'REMOVE_ITEM'      => [
            'grid'      => 'uint8',
            'unique_id' => 'uint64',
            'to'        => 'int32',
        ],
        'MOVE_ITEM'        => [
            'grid' => 'uint8',
            'from' => 'int32',
            'to'   => 'int32',
        ],
        'CALL_NPC'         => [
            'object_id' => 'uint32',
            'key'       => 'string',
        ],
        'BUY_ITEM'         => [
            'item_index' => 'uint64',
            'count'      => 'uint32',
            'type'       => 'uint8',
        ],
        'SELL_ITEM'        => [
            'unique_id' => 'uint64',
            'count'     => 'uint32',
        ],
        'DROP_ITEM'        => [
            'unique_id' => 'uint64',
            'count'     => 'uint32',
        ],
        'PICK_UP'          => [],
        'CHANGE_A_MODE'    => [
            'mode' => 'uint8',
        ],
        'CHANGE_P_MODE'    => [
            'mode' => 'uint8',
        ],
        'USE_ITEM'         => [
            'unique_id' => 'uint64',
        ],
        'DROP_GOLD'        => [
            'amount' => 'uint32',
        ],
        'REPAIR_ITEM'      => [
            'unique_id' => 'uint64',
        ],
    ];

    public $serverPacketStruct = [
        'CLIENT_VERSION'           => [
            'result' => 'uint8',
        ],
        'KEEP_ALIVE'               => [
            'time' => 'int64',
        ],
        'NEW_ACCOUNT'              => [
            'result' => 'uint8',
        ],
        'CHANGE_PASSWORD'          => [
            'result' => 'uint8',
        ],
        'LOGIN'                    => [
            'result' => 'uint8',
        ],
        'LOGIN_BANNED'             => [

        ],
        'LOGIN_SUCCESS'            => [
            'count'      => 'int32',
            'characters' => [
                'index'       => 'uint32',
                'name'        => 'string',
                'level'       => 'uint16',
                'class'       => 'int8',
                'gender'      => 'int8',
                'last_access' => 'int64',
            ],
        ],
        'NEW_CHARACTER'            => [
            'result' => 'uint8',
        ],
        'NEW_CHARACTER_SUCCESS'    => [
            'char_info' => [
                'index'       => 'uint32',
                'name'        => 'string',
                'level'       => 'uint16',
                'class'       => 'int8',
                'gender'      => 'int8',
                'last_access' => 'int64',
            ],
        ],
        'DELETE_CHARACTER'         => [
            'result' => 'uint8',
        ],
        'DELETE_CHARACTER_SUCCESS' => [
            'character_index' => 'int32',
        ],
        'START_GAME'               => [
            'result'     => 'uint8',
            'resolution' => 'int32',
        ],
        'SET_CONCENTRATION'        => [
            'object_id'   => 'uint32',
            'enabled'     => 'int8',
            'interrupted' => 'int8',
        ],
        'GAINED_ITEM'              => [
            'item' => [
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
        ],
        'NEW_ITEM_INFO'            => [
            'info' => [
                'id'              => 'int32',
                'name'            => 'string',
                'type'            => 'uint8',
                'grade'           => 'uint8',
                'required_type'   => 'uint8',
                'required_class'  => 'uint8',
                'required_gender' => 'uint8',
                'item_set'        => 'uint8',
                'shape'           => 'int16',
                'weight'          => 'uint8',
                'light'           => 'uint8',
                'required_amount' => 'uint8',
                'image'           => 'uint16',
                'durability'      => 'uint16',
                'stack_size'      => 'uint32',
                'price'           => 'uint32',
                'min_ac'          => 'uint8',
                'max_ac'          => 'uint8',
                'min_mac'         => 'uint8',
                'max_mac'         => 'uint8',
                'min_dc'          => 'uint8',
                'max_dc'          => 'uint8',
                'min_mc'          => 'uint8',
                'max_mc'          => 'uint8',
                'min_sc'          => 'uint8',
                'max_sc'          => 'uint8',
                'hp'              => 'uint16',
                'mp'              => 'uint16',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'luck'            => 'int8',
                'attack_speed'    => 'int8',
                'start_item'      => 'bool',
                'bag_weight'      => 'uint8',
                'hand_weight'     => 'uint8',
                'wear_weight'     => 'uint8',
                'effect'          => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'spell_recovery'  => 'uint8',
                'poison_recovery' => 'uint8',
                'hp_rate'         => 'uint8',
                'mp_rate'         => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'bools'           => 'uint8',
                'max_ac_rate'     => 'uint8',
                'max_mac_rate'    => 'uint8',
                'holy'            => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
                'bind'            => 'uint16',
                'reflect'         => 'uint8',
                'hp_drain_rate'   => 'uint8',
                'unique_item'     => 'int16',
                'random_stats_id' => 'uint8',
                'can_fast_run'    => 'bool',
                'can_awakening'   => 'bool',
                'is_tool_tip'     => 'bool',
                'tool_tip'        => 'string',
                // 'class_based'     => 'bool',
                // 'level_based'     => 'bool',
            ],
        ],
        'CHAT'                     => [
            'message' => 'string',
            'type'    => 'uint8',
        ],
        'OBJECT_WALK'              => [
            'object_id' => 'uint32',
            'location'  => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction' => 'uint8',
        ],
        'OBJECT_RUN'               => [
            'object_id' => 'uint32',
            'location'  => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction' => 'uint8',
        ],
        'OBJECT_TURN'              => [
            'object_id' => 'uint32',
            'location'  => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction' => 'uint8',
        ],
        'USER_LOCATION'            => [
            'location'  => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction' => 'uint8',
        ],
        'PLAYER_UPDATE'            => [
            'object_id'     => 'uint32',
            'light'         => 'uint8',
            'weapon'        => 'int16',
            'weapon_effect' => 'int16',
            'armour'        => 'int16',
            'wing_effect'   => 'uint8',
        ],
        'MAP_INFORMATION'          => [
            'file_name'      => 'string',
            'title'          => 'string',
            'mini_map'       => 'uint16',
            'big_map'        => 'uint16',
            'light'          => 'uint8',
            'lightning'      => 'bool',
            'map_dark_light' => 'uint8',
            'music'          => 'uint16',
        ],
        'USER_INFORMATION'         => [
            'object_id'                    => 'uint32',
            'real_id'                      => 'uint32',
            'name'                         => 'string',
            'guild_name'                   => 'string',
            'guild_rank'                   => 'string',
            'name_color'                   => 'int32',
            'class'                        => 'uint8',
            'gender'                       => 'uint8',
            'level'                        => 'uint16',
            'location'                     => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction'                    => 'uint8',
            'hair'                         => 'uint8',
            'hp'                           => 'uint16',
            'mp'                           => 'uint16',
            'experience'                   => 'int64',
            'max_experience'               => 'int64',
            'level_effect'                 => 'uint8',
            'inventory_bool'               => 'bool',
            'inventory_count'              => 'uint32',
            'inventory'                    => [
                'isset'           => 'bool',
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                // 'dura_changed'    => 'bool', //???TODO
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
            'equipment_bool'               => 'bool',
            'equipment_count'              => 'uint32',
            'equipment'                    => [
                'isset'           => 'bool',
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                // 'dura_changed'    => 'bool', //???TODO
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
            'quest_inventory_bool'         => 'bool',
            'quest_inventory_count'        => 'uint32',
            'quest_inventory'              => [
                'isset'           => 'bool',
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                // 'dura_changed'    => 'bool', //???TODO
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
            'gold'                         => 'uint32',
            'credit'                       => 'uint32',
            'has_expanded_storage'         => 'bool',
            'expanded_storage_expiry_time' => 'int64',
            'test'                         => 'uint32', //未知
            ////TODO
            // 'ClientMagics'              => [
            //     'name'       => 'string',
            //     'spell'      => 'int',
            //     'base_cost'  => 'uint8',
            //     'level_cost' => 'uint8',
            //     'icon'       => 'uint8',
            //     'level_1'    => 'uint8',
            //     'level_2'    => 'uint8',
            //     'level_3'    => 'uint8',
            //     'need_1'     => 'uint16',
            //     'need_2'     => 'uint16',
            //     'need_3'     => 'uint16',
            //     'level'      => 'uint8',
            //     'key'        => 'uint8',
            //     'experience' => 'uint16',
            //     'delay'      => 'int64',
            //     'range'      => 'uint8',
            //     'cast_time'   => 'int64',
            // ],
        ],
        'TIME_OF_DAY'              => [
            'lights' => 'uint8',
        ],
        'CHANGE_A_MODE'            => [
            'mode' => 'uint8',
        ],
        'CHANGE_P_MODE'            => [
            'mode' => 'uint8',
        ],
        'SWITCH_GROUP'             => [
            'allow_group' => 'bool',
        ],
        'LOG_OUT_SUCCESS'          => [
            'count'      => 'int32',
            'characters' => [
                'index'       => 'uint32',
                'name'        => 'string',
                'level'       => 'uint16',
                'class'       => 'int8',
                'gender'      => 'int8',
                'last_access' => 'int64',
            ],
        ],
        'OBJECT_REMOVE'            => [
            'object_id' => 'uint32',
        ],

        'OBJECT_TELEPORT_OUT'      => [
            'object_id' => 'uint32',
            'type'      => 'uint8',
        ],
        'OBJECT_PLAYER'            => [
            'object_id'          => 'uint32',
            'name'               => 'string',
            'guild_name'         => 'string',
            'guild_rank_name'    => 'string',
            'name_color'         => 'int32',
            'class'              => 'uint8',
            'gender'             => 'uint8',
            'level'              => 'uint16',
            'location'           => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction'          => 'uint8',
            'hair'               => 'uint8',
            'light'              => 'uint8',
            'weapon'             => 'int16',
            'weapon_effect'      => 'int16',
            'armour'             => 'int16',
            'poison'             => 'uint16', //TODO
            'dead'               => 'bool',
            'hidden'             => 'bool',
            'effect'             => 'uint8',
            'wing_effect'        => 'uint8',
            'extra'              => 'bool',
            'mount_type'         => 'int16',
            'riding_mount'       => 'bool',
            'fishing'            => 'bool',
            'transform_type'     => 'int16',
            'element_orb_effect' => 'uint32',
            'element_orb_lv_l'   => 'uint32',
            'element_orb_max'    => 'uint32',
            'buffs'              => '[]uint8',
            'level_effects'      => 'uint8',
        ],
        'OBJECT_TELEPORT_IN'       => [
            'object_id' => 'uint32',
            'type'      => 'uint8',
        ],
        'OBJECT_HEALTH'            => [
            'object_id' => 'uint32',
            'percent'   => 'uint8',
            'expire'    => 'uint8',
        ],
        'MAP_CHANGED'              => [
            'file_name'      => 'string',
            'title'          => 'string',
            'mini_map'       => 'uint16',
            'big_map'        => 'uint16',
            'lights'         => 'uint8',
            'location'       => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction'      => 'uint8',
            'map_dark_light' => 'uint8',
            'music'          => 'uint16',
        ],
        'OBJECT_MONSTER'           => [
            'object_id'           => 'uint32',
            'name'                => 'string',
            'name_color'          => 'int32',
            'location'            => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'image'               => 'uint16',
            'direction'           => 'uint8',
            'effect'              => 'uint8',
            'ai'                  => 'uint8',
            'light'               => 'uint8',
            'dead'                => 'bool',
            'skeleton'            => 'bool',
            'poison'              => 'uint16',
            'hidden'              => 'bool',
            'shock_time'          => 'int64',
            'binding_shot_center' => 'bool',
            'extra'               => 'bool',
            'extra_byte'          => 'uint8',
        ],
        'OBJECT_CHAT'              => [
            'object_id' => 'uint32',
            'text'      => 'string',
            'type'      => 'uint8',
        ],
        'OPENDOOR'                 => [
            'door_index' => 'uint8',
            'close'      => 'bool',
        ],
        'OBJECT_NPC'               => [
            'object_id'  => 'uint32',
            'name'       => 'string',
            'name_color' => 'int32',
            'image'      => 'uint16',
            'color'      => 'int32',
            'location'   => [
                'x' => 'uint32',
                'y' => 'uint32',
            ],
            'direction'  => 'uint8',
            'quest_ids'  => '[]int32',
        ],
        'NPC_RESPONSE'             => [
            'count' => 'uint32',
            'page'  => '[]string',
        ],
        'EQUIP_ITEM'               => [
            'grid'      => 'uint8',
            'unique_id' => 'uint64',
            'to'        => 'int32',
            'success'   => 'bool',
        ],
        'REMOVE_ITEM'              => [
            'grid'      => 'uint8',
            'unique_id' => 'uint64',
            'to'        => 'int32',
            'success'   => 'bool',
        ],
        'MOVE_ITEM'                => [
            'grid'    => 'uint8',
            'from'    => 'int32',
            'to'      => 'int32',
            'success' => 'bool',
        ],
        'PLAYER_UPDATE'            => [
            'object_id'     => 'uint32',
            'light'         => 'uint8',
            'weapon'        => 'int16',
            'weapon_effect' => 'int16',
            'armour'        => 'int16',
            'wing_effect'   => 'uint8',
        ],
        'NPC_GOODS'                => [
            'count' => 'uint32',
            'goods' => [
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
            'rate'  => 'float32',
            'type'  => 'uint8',
        ],
        'USER_STORAGE'             => [
            'isset'   => 'bool',
            'count'   => 'int32',
            'storage' => [
                'id'              => 'uint64',
                'item_id'         => 'int32',
                'current_dura'    => 'uint16',
                'max_dura'        => 'uint16',
                'count'           => 'uint32',
                'ac'              => 'uint8',
                'mac'             => 'uint8',
                'dc'              => 'uint8',
                'mc'              => 'uint8',
                'sc'              => 'uint8',
                'accuracy'        => 'uint8',
                'agility'         => 'uint8',
                'hp'              => 'uint8',
                'mp'              => 'uint8',
                'attack_speed'    => 'int8',
                'luck'            => 'int8',
                'soul_bound_id'   => 'uint32',
                'bools'           => 'uint8',
                'strong'          => 'uint8',
                'magic_resist'    => 'uint8',
                'poison_resist'   => 'uint8',
                'health_recovery' => 'uint8',
                'mana_recovery'   => 'uint8',
                'poison_recovery' => 'uint8',
                'critical_rate'   => 'uint8',
                'critical_damage' => 'uint8',
                'freezing'        => 'uint8',
                'poison_attack'   => 'uint8',
            ],
        ],
        'NPC_SELL'                 => [],
        'LOSE_GOLD'                => [
            'gold' => 'uint32',
        ],
        'DROP_ITEM'                => [
            'unique_id' => 'uint64',
            'count'     => 'uint32',
            'success'   => 'bool',
        ],
        'SELL_ITEM'                => [
            'unique_id' => 'uint64',
            'count'     => 'uint32',
            'success'   => 'bool',
        ],
        'OBJECT_ITEM'              => [
            'object_id'  => 'uint32',
            'name'       => 'string',
            'name_color' => 'int32',
            'location_x' => 'int32',
            'location_y' => 'int32',
            'image'      => 'uint16',
            'grade'      => 'uint8',
        ],
        'OBJECT_GOLD'              => [
            'object_id'  => 'uint32',
            'gold'       => 'uint32',
            'location_x' => 'int32',
            'location_y' => 'int32',
        ],
        'GAINED_GOLD'              => [
            'gold' => 'uint32',
        ],
        'USE_ITEM'                 => [
            'unique_id' => 'uint64',
            'success'   => 'bool',
        ],
        'DEATH'                    => [
            'location_x' => 'int32',
            'location_y' => 'int32',
            'direction'  => 'uint8',
        ],
        'OBJECT_DIED'              => [
            'object_id'  => 'int32',
            'location_x' => 'int32',
            'location_y' => 'int32',
            'direction'  => 'uint8',
            'type'       => 'uint8',
        ],
        'HEALTH_CHANGED'           => [
            'hp' => 'uint16',
            'mp' => 'uint16',
        ],
        'NEW_MAGIC'                => [
            'magic' => [
                'name'       => 'string',
                'spell'      => 'int',
                'base_cost'  => 'uint8',
                'level_cost' => 'uint8',
                'icon'       => 'uint8',
                'level_1'    => 'uint8',
                'level_2'    => 'uint8',
                'level_3'    => 'uint8',
                'need_1'     => 'uint16',
                'need_2'     => 'uint16',
                'need_3'     => 'uint16',
                'level'      => 'uint8',
                'key'        => 'uint8',
                'experience' => 'uint16',
                'delay'      => 'int64',
                'range'      => 'uint8',
                'cast_time'  => 'int64',
            ],
        ],
        'SET_OBJECT_CONCENTRATION' => [
            'object_id'   => 'uint32',
            'enabled'     => 'bool',
            'interrupted' => 'bool',
        ],
        'NPC_REPAIR'               => [
            'rate' => 'float32',
        ],
        'REPAIR_ITEM'              => [
            'unique_id' => 'uint64',
        ],
        'ITEM_REPAIRED'            => [
            'unique_id'    => 'uint64',
            'max_dura'     => 'uint16',
            'current_dura' => 'uint16',
        ],
    ];

    public function readPacketData(string $cmd, string $packet): array
    {
        $struct = $this->clientPacketStruct[$cmd] ?? [];

        if ($struct) {
            return $this->BinaryReader->read($struct, $packet);
        } else {
            return $struct;
        }
    }

    public function writePacketData(string $cmd, array $packet): string
    {
        $struct = $this->serverPacketStruct[$cmd] ?? '';
        if ($struct) {
            return $this->BinaryReader->write($struct, $packet);
        } else {
            return $struct;
        }
    }
}
